<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="tag" uri="com.sand.myTag" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/public.css" media="all">

</head>
<body>
<table style="margin: auto;">
    <tr>
        <td>
            <label class="layui-form-label">合同编号:</label>
            <div class="layui-input-inline">
                <input type="text" disabled value="${billShow.obj.rid}" class="layui-input">
            </div>
        </td>
        <td>
            <label class="layui-form-label">签约时间:</label>
            <div class="layui-input-inline">
                <input type="text" disabled value="${billShow.obj.contractDate}" class="layui-input">
            </div>
        </td>
        <td>
            <label class="layui-form-label">合同状态:</label>
            <div class="layui-input-inline">
                <c:if test="${billShow.obj.status==-1}">
                    <input type="text" disabled value="等待审核" class="layui-input">
                </c:if>
                <c:if test="${billShow.obj.status==0}">
                    <input type="text" disabled value="履行中" class="layui-input">
                </c:if>
                <c:if test="${billShow.obj.status==1}">
                    <input type="text" disabled value="租客停止" class="layui-input">
                </c:if>
                <c:if test="${billShow.obj.status==2}">
                    <input type="text" disabled value="房东停止" class="layui-input">
                </c:if>

            </div>
        </td>
        <td>
            <label class="layui-form-label">审核状态:</label>
            <div class="layui-input-inline">
                <input type="text" disabled value="${billShow.obj.confirm}" class="layui-input">
            </div>
        </td>
    </tr>
</table>
<hr/>
<c:forEach items="${billShow.list}" var="ite">
    <table style="margin: auto;">
        <tr>
            <td rowspan="2">
                <b>第${ite.phase}阶段</b>
            </td>
            <td>
                <label class="layui-form-label">支付金额:</label>
                <div class="layui-input-inline">
                    <input type="text" disabled value="${ite.amount}" class="layui-input">
                </div>
            </td>
            <td>
                <label class="layui-form-label">支付状态:</label>
                <div class="layui-input-inline">
                    <input type="text" disabled value="${ite.status==1?"已支付":"未支付"}" class="layui-input">
                </div>
            </td>
            <td>
                <label class="layui-form-label">支付方式:</label>
                <div class="layui-input-inline">
                    <input type="text" disabled value="${ite.payMethod}" class="layui-input">
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <label class="layui-form-label">交租日期:</label>
                <div class="layui-input-inline">
                    <input type="text" disabled value="${ite.rentPaymentDate}" class="layui-input">
                </div>
            </td>
            <td>
                <label class="layui-form-label">支付时间:</label>
                <div class="layui-input-inline">
                    <input type="text" disabled value="${ite.payTime}" class="layui-input">
                </div>
            </td>
            <td>
                <div class="layui-input-inline" style="float: right;">
                    <button class="layui-btn layui-btn-primary layui-border-red" lay-submit lay-filter="diy">推送账单</button>
                </div>

            </td>
        </tr>
    </table>
    <hr/>
</c:forEach>


<script src="${pageContext.request.contextPath}/layui/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath}/layui/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['form', 'tableSelect', 'table', 'laydate'], function () {
        var form = layui.form,
            layer = layui.layer,
            tableSelect = layui.tableSelect,
            laydate = layui.laydate,
            $ = layui.$;

        // $("#tb").append("<div class='layui-input-inline' style='float: left;'><button class='layui-btn layui-btn-primary layui-border-red' lay-submit lay-filter='diy'>推送账单</button></div>");

        //监听提交
        form.on('submit(delete)', function (data) {
            $.ajax({
                url:"${pageContext.request.contextPath}/question/delQuestionDetails",
                type:"post",
                data:"data="+JSON.stringify(data.field),
                dataType:"text",
                success:(rs)=>{
                    if(rs=="OK"){
                        layer.msg("删除成功",{icon:1,time:500},function (){
                            window.location.href="${pageContext.request.contextPath}/question/queryQuestionById?showWi=1&rid="+${obj.rid};
                        })
                    }else{
                        layer.msg("删除失败",{icon:2,time:500})
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
</html>